home *** CD-ROM | disk | FTP | other *** search
/ Nejlepší hry / Nejlepsi hry.iso / hry / sea of chaos / sea_install.msi / _15C39AAA7726369D39812BD40F01CF6A / _0FA02DF72CF9440EAF0833CE416A9587 < prev    next >
Text File  |  2004-11-20  |  879b  |  45 lines

  1. //sky pixel shader:
  2. //mixes color of 2 layers of sky
  3. //Luke Lenhart
  4. //(C)2004-2005 Digipen Institute of Technology
  5.  
  6. //blend factor between 2 layers
  7. float blend;
  8.  
  9. //"extra" color to add to final color
  10. float4 clrExtra;
  11.  
  12. //base color sampler
  13. sampler2D sampSky1;
  14.  
  15. //cloud sampler
  16. sampler2D sampSky2;
  17.  
  18. //shader input
  19. struct PS_INPUT
  20. {
  21.     float4 Color : COLOR;
  22.     float2 Tex0 : TEXCOORD0;
  23.     float2 Tex1 : TEXCOORD1;
  24. };
  25.  
  26. //shader code
  27. float4 PShader(PS_INPUT In) : COLOR
  28. {
  29.     //sample textutes
  30.     float4 sky1=tex2D(sampSky1,In.Tex0);
  31.     float4 sky2=tex2D(sampSky2,In.Tex1);
  32.  
  33.     //base color is blend of the 2 laters
  34.     float4 clr=lerp(sky1,sky2,blend);
  35.     
  36.     //alpha is modulus of both blended with base
  37.     clr.a=lerp(sky1.a*0.5f, sky2.a, blend*blend);
  38.     
  39.     //blend with vert color
  40.     clr*=In.Color + clrExtra*In.Color.a;
  41.     
  42.     //spit out color
  43.     return clr;
  44. }
  45.